home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 293 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  59 lines

  1. Path: ix.netcom.com!netnews
  2. From: nanninr@ix.netcom.com(Robert A. Nannini )
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Borland C++ v4.0 (Windows) Container classes
  5. Date: 3 Jan 1996 16:35:20 GMT
  6. Organization: Netcom
  7. Message-ID: <4ceb88$i8o@cloner2.ix.netcom.com>
  8. References: <4cd20q$1h3e@news-s01.ny.us.ibm.net>
  9. NNTP-Posting-Host: ix-stl4-13.ix.netcom.com
  10. X-NETCOM-Date: Wed Jan 03  8:35:20 AM PST 1996
  11.  
  12. In <4cd20q$1h3e@news-s01.ny.us.ibm.net> zingg@ibm.net writes: 
  13. >
  14. >I am writing a small Windows program that uses the dictionary
  15. container class in Borland C++ v4.0.  I have part of the application in
  16. a DLL.  As soon as I placed the source file that contained the
  17. container class logic in the DLL, the program stopped working.
  18. >The program links correctly and everything, however, when I run the
  19. program it terminates immediately with a normal return code.  If I use
  20. the Turbo Debugger, the program terminates before even reaching the
  21. first line of code.  My only guess is that 
  22. >there is some sort of option or something I need to invoke that will
  23. allow the container class to be used in a DLL.  Maybe something in the
  24. function resolution when my program attempts to bind with the dll is
  25. causing the program termination?  Does anyone
  26. >have any idea on what is happening or how I can possibly fix it?
  27. >
  28. >thank you
  29.  
  30. Borland 4.0 has a bug in their handling of templates within and among
  31. dll's.  We ran into this problem while attempting to pass a
  32. TArrayAsVector between a .dll and an .exe.  What we did was the
  33. following, as prescribed by Borland:
  34.  
  35. ----------
  36. class _export MyClass {
  37.   public:
  38.     MyClass(); 
  39. };
  40.  
  41. #pragma option -Jgd
  42.  
  43. //array of MyClass
  44. typedef TArrayAsVector<MyClass> tMyArray;
  45. class MyArray : public tMyArray {
  46.   public:
  47.     MyArray() : tMyArray(3, 0, 3) {}
  48. };
  49.  
  50. #pragma option -Jgx
  51. ----------
  52.  
  53. As you can see, at the end of all this you have a class with all the
  54. functionality of Borland's TArray class, plus the ability to pass it as
  55. you would anything else.  Hope this helps.
  56.  
  57. bob
  58. nanninr@ix.netcom.com
  59.